import scrapy
from scrapy import cmdline
from scrapy.http import HtmlResponse

class BaiduSpiderSpider(scrapy.Spider):
    name = "baidu_spider"
    allowed_domains = ["www.baidu.com"]
    start_urls = ["https://www.baidu.com"]

    def parse(self, response):
        title = response.css('title::text').extract_first()
        print({'title': title})
        yield {'title': title}


if __name__ == '__main__':
    cmdline.execute("scrapy crawl baidu_spider".split())